<?php $this->load->view('admin/_header2') ?>

<table id="tt" class="easyui-datagrid" style="width:1100px;height:auto;">
	<thead>
	<tr height=32 >
		<th field="name0" align=center  width=30 ></th>
		<th field="name1" align=center  width=80 >Type</th>
		<th field="fPNR" align=center  width=50 >Airline</th>
		<th field="name2" align=center  width=100 >From Port</th>
		<th field="name3" align=center  width=100 >DestPort</th>
		<th field="name4" align=center  width=100>Apply flight</th>
		<th field="name6" align=center  width=80>Ticket Time</th>
		<th field="name7" align=center  width=80 >Flight date</th>
		<th field="name8" align=center  width=100 >Week</th>
		<th field="name9" align=center  width=80>Class Code</th>
		<th field="name10" align=center  width=80>Discount</th>
		<th field="name11" align=center  width=80>Fare</th>
		<th field="name12" align=center  width=120>Oper</th>
	</tr>
	</thead>
	<tbody>
	<?php
	
	$index=0;
	foreach($result as $item)
	{
		$index++;
	?><tr align=center >
		<td><?=$index ?></td>
		<td><?php
			if(stripos("S",$item->ClassType)>-1)
			{
				echo "One way";
			}
			if(stripos("R",$item->ClassType)>-1)
			{
				echo "<BR>roundtrip";
			}
		?></td>
		<td><?=$item->Airline  ?></td>
		<td><?=$item->FromPorts ?></td>
		<td><?=$item->DestPorts  ?></td>
		<td><?=$item->FlightNum1 ?></td>
		<td><?=Date("Y-m-d",strtotime($item->SalesDate1))."<br/>".Date("Y-m-d",strtotime($item->SalesDate2));  ?></td>
		<td><?=Date("Y-m-d",strtotime($item->FlightDate1))."<br/>".Date("Y-m-d",strtotime($item->FlightDate2)); ?></td>
		<td><?=$item->WeekDay1  ?></td>
		<td><?=$item->ClassCode ?></td>
		<td><?=$item->Discount ?></td>
		<td><?=$item->Fare ?></td>
		<td><a href="#" class="orangeb" onclick="return editPrivate('<?=$item->PolicyGroup?>','<?=$item->ProductType?>');" >edit</a>
			|<a href="#" class="orangeb" onclick="return deletePolicy('<?=$item->PolicyID?>');" >delete</a>	
		</td>
	</tr>
	<?php
	}
	?></tbody>
</table>
<div id="pp" style="background:#efefef;border:1px solid #ccc;"></div>

<div id="addwin" class="easyui-window" title="oper Order" closed="true" iconCls="icon-edit" style="width:680px;height:400px;padding:0px;background: #fafafa;">
	<div class="easyui-layout" fit="true">
		<div id="dvcontext" region="center" border="false" style="padding:10px;background:#fff;border:1px solid #ccc;">
			<iframe width=100% height=100% name="icontext" id="ifracontext" src="" frameborder=0 ></iframe>
		</div>
	</div>
</div>
<?
echo form_open("",array("id"=>"formquery"));
echo form_hidden($_POST);
echo form_close();

?>
<script language="javascript">
function editPrivate(PolicyGroup,ProductType)
{
	window.parent.editPrivate(PolicyGroup,ProductType);
	return false;
}

function deletePolicy(sid)
{
	if(confirm("confirm to Delete this Policy?"))
	{
		window.location="deletePolicy?id="+sid;	
	}
	
	return false;
}

$(function(){
	$('#pp').pagination({
		total:<?=$iTotalCount?>,pageNumber:<?=$_POST['pagenumber']?>,pageSize:<?=$_POST['pagesize']?>,pageList:[2,5,10,20,30,50],
		onSelectPage:function(pageNumber, pageSize){
			$(this).pagination('loading');
			//alert('pageNumber:'+pageNumber+',pageSize:'+pageSize);
			$("input[name=pagesize]").val(pageSize);
			$("input[name=pagenumber]").val(pageNumber);
			$("#formquery").submit();
			$(this).pagination('loaded');
		}
	});
});
</script>
<?php $this->load->view('admin/_footer1') ?>